<html>
<head><meta charset="utf-8"><title>Emacs and trace.sever for rust-analyzer · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html">Emacs and trace.sever for rust-analyzer</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="192931819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192931819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192931819">(Apr 04 2020 at 23:20)</a>:</h4>
<p>Hi! I've just installed Rust Analyzer ( 2020-03-30 build) and I'm trying to figure out the configuration for Emacs with <code>lsp-mode</code>.</p>
<p>First question. When emacs starts, rust-analyzer starts too (good). However I see RA keeping all CPU cores working like crazy for ~10s. I'd like to understand what is RA doing. I'd like to set <code>trace.server</code> in my emacs config and be able to read somewhere some useful debug.</p>
<p>Is that part of <code>lsp-rust</code> relevant to such inizialization?  How do I enable server tracing?<br>
<a href="https://github.com/emacs-lsp/lsp-mode/blob/acc0531b7f7a04aeb8055c8ed5dc0fbfa0fe7fbb/lsp-rust.el#L504" title="https://github.com/emacs-lsp/lsp-mode/blob/acc0531b7f7a04aeb8055c8ed5dc0fbfa0fe7fbb/lsp-rust.el#L504">https://github.com/emacs-lsp/lsp-mode/blob/acc0531b7f7a04aeb8055c8ed5dc0fbfa0fe7fbb/lsp-rust.el#L504</a></p>
<p>EDIT: I think this issue is relevant<br>
<a href="https://github.com/emacs-lsp/lsp-mode/issues/1559" title="https://github.com/emacs-lsp/lsp-mode/issues/1559">https://github.com/emacs-lsp/lsp-mode/issues/1559</a></p>



<a name="192933702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192933702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192933702">(Apr 05 2020 at 00:22)</a>:</h4>
<p>Kind of answering to myself, I opened a PR but I'm not sure of what I'm doing<br>
<a href="https://github.com/emacs-lsp/lsp-mode/pull/1564" title="https://github.com/emacs-lsp/lsp-mode/pull/1564">https://github.com/emacs-lsp/lsp-mode/pull/1564</a></p>



<a name="192946809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192946809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192946809">(Apr 05 2020 at 07:45)</a>:</h4>
<blockquote>
<p>I'd like to understand what is RA doing.</p>
</blockquote>
<p>It used to not do anything, but now it's analyzing some of the source code to make further operations faster. See <a href="https://github.com/rust-analyzer/rust-analyzer/pull/3474" title="https://github.com/rust-analyzer/rust-analyzer/pull/3474">https://github.com/rust-analyzer/rust-analyzer/pull/3474</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1650" title="https://github.com/rust-analyzer/rust-analyzer/issues/1650">https://github.com/rust-analyzer/rust-analyzer/issues/1650</a>.</p>



<a name="192946982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192946982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192946982">(Apr 05 2020 at 07:50)</a>:</h4>
<p>It also depends on the editor: Code has native support for semantic highlighting and it will trigger that analysis for the open files anyway.</p>



<a name="192948552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192948552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192948552">(Apr 05 2020 at 08:33)</a>:</h4>
<p>does the <code>trace.server</code> option even still exist? I can't find any reference to it in the code. You'd want to use <code>lsp-log-io</code> in Emacs though.</p>



<a name="192948595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192948595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192948595">(Apr 05 2020 at 08:34)</a>:</h4>
<p>and/or set <code>RUST_LOG=error</code> on the rust-analyzer call</p>



<a name="192953900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192953900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192953900">(Apr 05 2020 at 11:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="129457">Florian Diebold</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer/near/192948552" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer/near/192948552">said</a>:</p>
<blockquote>
<p>does the <code>trace.server</code> option even still exist? I can't find any reference to it in the code. You'd want to use <code>lsp-log-io</code> in Emacs though.</p>
</blockquote>
<p>I think so as it is mentioned in the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialize" title="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialize">LSP specs</a>. And I've discovered the emacs <code>lsp-mode</code> package has already an option to activate that <span aria-label="smile" class="emoji emoji-263a" role="img" title="smile">:smile:</span>  <br>
Anyway good to know also about the <code>lsp-log-io</code> (duh, it was on the README.md too ...)</p>
<p>thanks!</p>



<a name="192953917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/192953917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#192953917">(Apr 05 2020 at 11:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer/near/192946809" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer/near/192946809">said</a>:</p>
<blockquote>
<p>It used to not do anything, but now it's analyzing some of the source code to make further operations faster. See <a href="https://github.com/rust-analyzer/rust-analyzer/pull/3474" title="https://github.com/rust-analyzer/rust-analyzer/pull/3474">https://github.com/rust-analyzer/rust-analyzer/pull/3474</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1650" title="https://github.com/rust-analyzer/rust-analyzer/issues/1650">https://github.com/rust-analyzer/rust-analyzer/issues/1650</a>.</p>
</blockquote>
<p>I've read that issue and, yes, now I understand it's supposed to happen when I first open emacs on a project <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="193003201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/193003201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#193003201">(Apr 06 2020 at 07:23)</a>:</h4>
<p><code>trace.server</code> is  a <strong>magical</strong> config setting, which is fully implemented in the client. That is, we don't have any special code for it, but VS Code still uses is to show the full log of requests.</p>
<p>I wonder if it makes sense for lsp-mode uses the same setting as well...</p>



<a name="193014403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20and%20trace.sever%20for%20rust-analyzer/near/193014403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20and.20trace.2Esever.20for.20rust-analyzer.html#193014403">(Apr 06 2020 at 09:13)</a>:</h4>
<p>lsp-mode does have <code>lsp-server-trace</code> and <code>lsp-log-io</code> (I think this is actually more like <code>lsp-log-io</code>, if it logs requests/responses in the client?)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>